<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Amaze UI Admin user Examples</title>
  <meta name="description" content="这是一个 user 页面">
  <meta name="keywords" content="user">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="/Public/assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="/Public/assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="/Public/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="/Public/assets/css/admin.css">
  <script src="/Public/js/template-native.js"></script>
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<include file="./Application/Admin/View/Share/header.html" />

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <include file="./Application/Admin/View/Share/left.html" />
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">商品管理</strong></div>
      </div>

      <hr/>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
          

        </div>

        <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4">
          <form class="am-form am-form-horizontal" enctype="multipart/form-data" action="/Admin/ware/insert?id={$id}" method="post" name="ware_form">
            <div class="am-form-group">
              <label for="ware-name" class="am-u-sm-3 am-form-label">商品名称</label>
              <div class="am-u-sm-9">
                <input type="text" id="ware-name" name="ware_name" placeholder="" value="{$list.ware_name}">
              </div>
            </div>

            <div class="am-form-group">
				<label for="user-name" class="am-u-sm-3 am-form-label">商品类别</label>
				<div class="am-u-sm-9">
					<select id="doc-select-1" name="typenum">
							<option value="请选择类别" >请选择类别</option>
						<volist name="typelist" id="voa">
							<option value="{$voa.typenum}" class="typenum">{$voa.name}</option>
						</volist>
					</select>
				</div>
			</div>
			
			<div class="am-form-group">
				<label for="user-name" class="am-u-sm-3 am-form-label">子分类</label>
				<div class="am-u-sm-9">
					<select id="sub-show" name="subnum">
						
							
						
					</select>
				</div>
			</div>
            
            <div class="am-form-group">
              <label for="ware-name" class="am-u-sm-3 am-form-label">商品价格</label>
              <div class="am-u-sm-9">
                <input type="text" id="ware-price" name="price" placeholder="" value="{$list.price}">
              </div>
            </div>
            
            <div class="am-form-group">
              <label for="user-phone" class="am-u-sm-3 am-form-label">封面图</label>
              <div class="am-u-sm-9">
				<input type="file" id="user-pic" name="img" />
				<img src="{$list.head_img}" width="100px" height="100px" /> 
              </div>
            </div>
			
            <div class="am-form-group">
              <div class="am-u-sm-9 am-u-sm-push-3">
                <button type="button" onclick="do_submit();" class="am-btn am-btn-primary">保存修改</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>

    

  </div>
  <!-- content end -->

</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>

<include file="./Application/Admin/View/Share/footer.html" />
<script id="sub-list-tql" type="text/html">
<%for (var i=0;i<data.length;i++) {%>
	<option value="<%=data[i].subnum%>" class="subnum"><%=data[i].subname%></option>
<%}%>
</script>

<script src="/Public/assets/js/jquery.min.js"></script>
<script src="/Public/assets/js/amazeui.min.js"></script>
<script src="/Public/assets/js/app.js"></script>


<!--点击改变按钮成提交-->
<script>
	//提交方法
	function do_submit(){
		document.ware_form.submit();
	}
	
	//显示子分类方法
	function sublist(){
		$('#doc-select-1').click(function(){
			var typenum = $(this).val();
			
			$.get('/Api/ware/add' , {typenum:typenum} , function(ret){
				if( ret.status == true){
					var res = template('sub-list-tql',ret);
					$('#sub-show').html(res);
				}
			})
		});
	}
	sublist();
</script>
</body>
</html>
